package com.zy.explore.sys.interfaces.facade.v1;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.zy.explore.common.interfaces.vo.ResultVO;
import com.zy.explore.sys.interfaces.assembler.StatisticsAssembler;
import com.zy.explore.sys.interfaces.vo.DataOverViewVO;
import com.zy.explore.sys.interfaces.vo.RecentVisitDataVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * description 数据统计控制器
 *
 * @author ChinaYin  主页:https://gitee.com/zy-explorej2ee 邮箱:zyexplorej2ee@sina.com
 * @date 2021年05月27日 22:18
 */
@Api(tags = "数据统计控制器")
@RestController
@RequestMapping("/statistics")
public class StatisticsFacade {

    @Resource
    private StatisticsAssembler assembler;

    @ApiOperationSupport(order = 10)
    @ApiOperation("查询首页统计数据")
    @GetMapping("/getDataOverView")
    public ResultVO<DataOverViewVO> getDataOverView() {
        return ResultVO.getSuccess(assembler.getDataOverView());
    }

    /**
     * 查询首页近N天的访问统计数据
     *
     * @param recentDays 最近N天
     * @return 返回统计数据
     */
    @ApiOperationSupport(order = 20)
    @ApiOperation("查询首页近N天的访问统计数据")
    @GetMapping("/getRecentVisitData")
    public ResultVO<RecentVisitDataVO> getRecentVisitData(int recentDays) {
        return ResultVO.getSuccess(this.assembler.getRecentVisitData(recentDays));
    }

}
